All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.security.x509.X500Name

java.lang.Object
   |
   +----sun.security.x509.X500Name

public class X500Name
extends Object
implements Principal
X.500 names are used to identify entities, such as those which are identified by X.509 certificates. They are world-wide, hierarchical, and descriptive. Entities can be identified by attributes, and in some systems can be searched for according to those attributes.

This class exposes only partial X.500 name functionality. Most notably, it works best if Relative Distinguished Names only have one (unique) attribute each, and if only the most common attributes need to be visible to applications. This limitation, and others, will be lifted over time.


Variable Index

 o commonName_oid
OID for the "CN=" attribute, denoting a person's common name.
 o countryName_oid
OID for the "C=" attribute, denoting a country.
 o ipAddress_oid
OID for "IP=" IP address attributes, used with SKIP.
 o localityName_oid
OID for the "L=" attribute, denoting a locality (such as a city)
 o orgName_oid
OID for the "O=" attribute, denoting an organization name
 o orgUnitName_oid
OID for the "OU=" attribute, denoting an organizational unit name
 o stateName_oid
OID for the "S=" attribute, denoting a state (such as Delaware)
 o streetAddress_oid
OID for the "STREET=" attribute, denoting a street address.
 o title_oid
OID for the "T=" attribute, denoting a person's title.

Constructor Index

 o X500Name(DerInputStream)
Constructs a name from an ASN.1 encoded input stream.
 o X500Name(DerValue)
Constructs a name from an ASN.1 encoded value.
 o X500Name(String, String, String, String)
Constructs a name from fields common in enterprise application environments.
 o X500Name(String, String, String, String, String, String)
Constructs a name from fields common in Internet application environments.

Method Index

 o emit(DerOutputStream)
Emits the name in DER-encoded form.
 o equals(X500Name)
Compares this name with another, for equality.
 o getCommonName()
Returns a "Common Name" component.
 o getCountry()
Returns a "Country" name component.
 o getLocality()
Returns a "Locality" name component.
 o getName()
Returns the value of toString().
 o getOrganization()
Returns an "Organization" name component.
 o getOrganizationalUnit()
Returns an "Organizational Unit" name component.
 o getState()
Returns a "State" name component.
 o toString()
Returns a string form of the X.500 distinguished name.

Variables

 o commonName_oid
 public static final ObjectIdentifier commonName_oid
OID for the "CN=" attribute, denoting a person's common name.

 o countryName_oid
 public static final ObjectIdentifier countryName_oid
OID for the "C=" attribute, denoting a country.

 o localityName_oid
 public static final ObjectIdentifier localityName_oid
OID for the "L=" attribute, denoting a locality (such as a city)

 o orgName_oid
 public static final ObjectIdentifier orgName_oid
OID for the "O=" attribute, denoting an organization name

 o orgUnitName_oid
 public static final ObjectIdentifier orgUnitName_oid
OID for the "OU=" attribute, denoting an organizational unit name

 o stateName_oid
 public static final ObjectIdentifier stateName_oid
OID for the "S=" attribute, denoting a state (such as Delaware)

 o streetAddress_oid
 public static final ObjectIdentifier streetAddress_oid
OID for the "STREET=" attribute, denoting a street address.

 o title_oid
 public static final ObjectIdentifier title_oid
OID for the "T=" attribute, denoting a person's title.

 o ipAddress_oid
 public static final ObjectIdentifier ipAddress_oid
OID for "IP=" IP address attributes, used with SKIP.

Constructors

 o X500Name
 public X500Name(String commonName,
                 String organizationUnit,
                 String organizationName,
                 String country) throws IOException
Constructs a name from fields common in enterprise application environments.

NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.

Parameters:
commonName - common name of a person, e.g. "Vivette Davis"
organizationUnit - small organization name, e.g. "Purchasing"
organizationName - large organization name, e.g. "Onizuka, Inc."
country - two letter country code, e.g. "CH"
 o X500Name
 public X500Name(String commonName,
                 String organizationUnit,
                 String organizationName,
                 String localityName,
                 String stateName,
                 String country) throws IOException
Constructs a name from fields common in Internet application environments.

NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.

Parameters:
commonName - common name of a person, e.g. "Vivette Davis"
organizationUnit - small organization name, e.g. "Purchasing"
organizationName - large organization name, e.g. "Onizuka, Inc."
localityName - locality (city) name, e.g. "Palo Alto"
stateName - state name, e.g. "California"
country - two letter country code, e.g. "CH"
 o X500Name
 public X500Name(DerValue value) throws IOException
Constructs a name from an ASN.1 encoded value. The encoding of the name in the stream uses DER (a BER/1 subset).

Parameters:
value - a DER-encoded value holding an X.500 name.
 o X500Name
 public X500Name(DerInputStream in) throws IOException
Constructs a name from an ASN.1 encoded input stream. The encoding of the name in the stream uses DER (a BER/1 subset).

Parameters:
in - DER-encoded data holding an X.500 name.

Methods

 o equals
 public boolean equals(X500Name other)
Compares this name with another, for equality.

Returns:
true iff the names are identical.
 o getCountry
 public String getCountry() throws IOException
Returns a "Country" name component. If more than one such attribute exists, the topmost one is returned.

Returns:
"C=" component of the name, if any.
 o getOrganization
 public String getOrganization() throws IOException
Returns an "Organization" name component. If more than one such attribute exists, the topmost one is returned.

Returns:
"O=" component of the name, if any.
 o getOrganizationalUnit
 public String getOrganizationalUnit() throws IOException
Returns an "Organizational Unit" name component. If more than one such attribute exists, the topmost one is returned.

Returns:
"OU=" component of the name, if any.
 o getCommonName
 public String getCommonName() throws IOException
Returns a "Common Name" component. If more than one such attribute exists, the topmost one is returned.

Returns:
"CN=" component of the name, if any.
 o getLocality
 public String getLocality() throws IOException
Returns a "Locality" name component. If more than one such component exists, the topmost one is returned.

Returns:
"L=" component of the name, if any.
 o getState
 public String getState() throws IOException
Returns a "State" name component. If more than one such component exists, the topmost one is returned.

Returns:
"S=" component of the name, if any.
 o toString
 public String toString()
Returns a string form of the X.500 distinguished name. The format of the string is from RFC 1779.

Overrides:
toString in class Object
 o getName
 public String getName()
Returns the value of toString(). This call is needed to implement the java.security.Principal interface.

 o emit
 public void emit(DerOutputStream out) throws IOException
Emits the name in DER-encoded form.

Parameters:
out - where to put the DER-encoded X.500 name

All Packages  Class Hierarchy  This Package  Previous  Next  Index